<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/5
 * Time: 13:55
 */

namespace App\Http\Traits;


use Illuminate\Http\Request;

trait PartnerTrait
{
    use BaseTrait;

    // 验证秘钥
    protected $loginSession;

    // 页面大小限制
    protected $limit;
    // 合作者ID
    protected $partner_id;
    // 合作者类型
    protected $type;
    // 合作者LOGO文件
    protected $logo_file;
    // 合作者微信公众号微信号
    protected $weixin_name;
    // 合作者名称
    protected $name;
    // 合作者LOGO
    protected $logo;
    // 合作者简介
    protected $summary;
    // 合作者公众号微信号
    protected $gzh;
    // 合作者公众号名称
    protected $gzh_name;
    // 合作者联系方式
    protected $mobile;
    // 合作者创办时间
    protected $since;
    // 链接
    protected $url;
    // 视频ID
    protected $video_id;

    public function __construct(Request $request)
    {
        $this->loginSession = $request->input('loginSession', '');
        $this->limit = $request->input('limit', 0);
        $this->partner_id = $request->input('partner_id', 0);
        $this->type = $request->input('type', 0);
        if (!empty($request->file('file', ''))){
            $this->logo_file = $request->file('file', '')->store('temp');
        }
        $this->weixin_name = $request->input('weixin_name', '');
        $this->name = $request->input('name', '');
        $this->logo = $request->input('logo', '');
        $this->summary = $request->input('summary', '');
        $this->gzh = $request->input('gzh', '');
        $this->gzh_name = $request->input('gzh_name', '');
        $this->mobile = $request->input('mobile', '');
        $this->since = $request->input('since', '');
        $this->url = $request->input('url', '');
        $this->video_id = $request->input('video_id', 0);
    }
}